const _finished = Symbol('Finished');
export class Content {
    _type: string;
    constructor (type: string) {
        this._type = type;
        Object.defineProperty(this, _finished, {
            enumerable: false,
            writable: true,
            value: true,
        })
    }
    getResolve() {
        return Promise.resolve();
    }
    unfinish() {
        // @ts-ignore
        this[_finished] = false;
    }
    finish() {
        // @ts-ignore
        this[_finished] = true;
    }
    isFinished() {
        return Object.getOwnPropertyDescriptor(this, _finished).value;
    }
    toJSON() {
        return Object.getOwnPropertyNames(this).reduce((obj: any, name: string) => {
            obj[name] = Object.getOwnPropertyDescriptor(this, name).value;
            return obj; 
        }, {})
    }
}